
/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"4E25C823-0677-4B2D-99A8-FA5BA803C6F9"}
 */
function onDataChangePais(oldValue, newValue, event) {
	globals.gpais = newValue
	return true
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E2CA89E2-CA0D-48D9-BE2B-A22CE0F52209"}
 */
function aceptar(event) {
	if (databaseManager.saveData())
	{
		globals.DIALOGS.showInfoDialog('Aviso','Ciudad dada de alta','OK')
		databaseManager.setAutoSave(true)
		var $win = application.getWindow('CIUDAD_ALTA')
		$win.hide()
		$win.destroy()
	}
	else
	{
		globals.DIALOGS.showWarningDialog('Aviso','Ocurrió un error y no se pudo dar de alta','OK')
		cancelar()
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} [event] the event that triggered the action
 *
 * @properties={typeid:24,uuid:"F3732E84-3F19-4FEB-894E-D40DD0E54C0B"}
 */
function cancelar(event) {
	var $win = application.getWindow('CIUDAD_ALTA')
	$win.hide()
	$win.destroy()
}

/**
 * Handle hide window.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"80FB6E66-AD95-48C5-AB5C-A56FE98F46F9"}
 */
function onHide(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	return true
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E590DDB0-019C-41D1-9237-DB40EB218998"}
 */
function onShow(firstShow, event) {
	databaseManager.setAutoSave(false)
	controller.newRecord()
	activo = 1
}
